﻿using System.Runtime.Serialization;

namespace TimeTravel.Components
{
    /// <summary>
    /// 主页导航菜单
    /// </summary>
    [DataContract]
    public class NavMenuInfo : BaseComponent
    {
        /// <summary>
        /// 菜单文本
        /// </summary>	
        [DataMember(Name = "text")]	
        public string Text { get; set; }
        /// <summary>
        /// 父级菜单（默认无父级菜单，即为0）
        /// </summary>
        [DataMember(Name = "fatherid")]		
        public int FatherID { get; set; }
        /// <summary>
        /// 链接地址（可为锚点）
        /// </summary>		
        [DataMember(Name = "linkurl")]
        public string LinkUrl { get; set; }
        /// <summary>
        /// 排序（越大越靠前。默认为0）
        /// </summary>		
        private int _sort;
        [DataMember(Name = "sort")]
        public int Sort
        {
            get { return _sort; }
            set 
            {
                if (value < 0)
                {
                    value = 0;
                }
                _sort = value;
            }
        }
        /// <summary>
        /// 链接方式
        /// </summary>
        [DataMember(Name = "target")]
        public string Target { get; set; }
    }
}